package xyz.lisys.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;
import xyz.lisys.dao.CedUsersDao;
import xyz.lisys.model.CedUsers;

import javax.annotation.Resource;

@Repository("cedUsersDao")
public class CedUsersDaoImpl implements CedUsersDao {
    @Resource(name = "sessionFactory")
    private SessionFactory sessionFactory;

    @Override
    public CedUsers getUser(Integer id) {
        Session session = sessionFactory.getCurrentSession();
        return session.get(CedUsers.class, id);
    }

    @Override
    public void saveUser(CedUsers user) {
        Session session = sessionFactory.getCurrentSession();
        session.save(user);
    }
}
